{
  "properties" : { },
  "id" : "e8e19085e7b546b198860eed205b5811",
  "script" : null,
  "groupId" : "43baf95fba7a40cebd8be100bec36201",
  "name" : "取消订单",
  "createTime" : null,
  "updateTime" : 1741367987257,
  "lock" : null,
  "createBy" : null,
  "updateBy" : null,
  "path" : "cancel",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : null,
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : null
}
================================
import cn.dev33.satoken.stp.StpUtil
var userId = StpUtil.getLoginId()

var orderNo = body.orderNo
var id = body.id

// let orders = db.table("orders").where().eq("orderNo", orderNo).selectOne()
let orders = db.table("orders").where().eq("id", id).selectOne()
if (orders == null) {
    exit 400, "订单不存在";
}

db.table("orders").primary("id").update({
    id: orders.id,
    status: "cancel",
    update_by: userId,
    update_date: now()

})

return "订单取消成功"